#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require


#include "../../../../core/shader_std.h" 
#include "../../../../core/shader_mesh.h" 



layout(location = 0) in vec4 vColor;
layout(location = 1) in vec3 vNormal;
layout(location = 2) in vec3 vLightPos[4];
layout(location = 6) in float DepthScale;
//layout(location = 6) in flat uint vInstanceIndex;

layout(location=0) out vec4 outColor;




//layout(std140, set=0, binding=3) uniform U_Matrix {
//	uint m_Color;
//};
layout(binding = DEF_BINDING_ObMesh, scalar) readonly buffer B_ObMesh { S_ObMesh m_ObMesh[]; };



void main(void) {
	float d = (dot(vLightPos[0], vNormal)) + 1.0;
	float PN = dot(vLightPos[0], vNormal);

	//vec4 Color = f_glsl_buildColor(InstanceColor[vInstanceIndex]);
	outColor = vec4(vColor.rgb * d * 0.5, vColor.a);
	//outColor = vec4(Color.rgb * d, Color.a);
	//outColor.rgb += vec3(0.2, 0.21, 0.22) * d;
	/*if(PN >= 0){
		outColor.rgb = vec3(0,0,1);
	} else {
		outColor.rgb = vec3(1,0,0);
	}*/
	float ds = DepthScale;
	//ds = 1;
	gl_FragDepth = gl_FragCoord.z * ds;

	//outColor = vec4(1,0,0,1);
}



